package com.bjsxt.set1;

import java.util.Comparator;

public class StuScoreNameDescComparator implements Comparator<Student> {
    @Override
    public int compare(Student stu1, Student stu2) {
        if(stu1.getScore()>stu2.getScore()){
            return 1;
        }else if(stu1.getScore()<stu2.getScore()){
            return -1;
        }else{
           // return 0;
            return -stu1.getName().compareTo(stu2.getName());
        }
        //return  (int)(stu1.getScore()-stu2.getScore()); // 98.5 -98 =0.5 --->0
    }
}
